<?php

use Biz\Constants\Site\SiteVisaConstants;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * SiteVisa.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class SiteVisa extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('site_visa', function (Blueprint $table) {
            $table->bigIncrements('id');//BigID unsigned
            $table->unsignedBigInteger('user_id');//用户ID
            $table->unsignedBigInteger('site_id');//所属站点ID

            $table->string('relationship', 128);// 关系，如自己，同事、好友、秘书
            $table->string('full_name', 128);// 全名
            $table->string('gender', 8);// 性别，如female、male
            $table->dateTime('birthday');// 出生日期
            $table->string('nationality', 128);// 国籍
            $table->string('passport_number', 128);// 护照号码
            $table->string('address', 255);// 大学/院校+居住地
            $table->string('designation_title', 128);// 称呼或头衔
            $table->string('issuing_country', 128);// 签证颁发国家
            $table->dateTime('duration_arrival');// 签证生效日期
            $table->dateTime('duration_departure');// 签证失效效日期
            $table->string('passport_front_url');// 护照正面图片地址
            $table->string('passport_back_url')->default('');// 护照反面图片地址

            $table->tinyInteger('status')->default(SiteVisaConstants::STATUS_NORMAL);//状态
            
            // 注意时间戳位数
            $table->timestamps();

            // index
            $table->index('user_id');
            $table->index('site_id');
            $table->index(['user_id', 'site_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('site_visa');
    }
}